
/**		
 * 
 *	uk.co.lmfm.guppy.view.ApplicationMediator
 *	
 *	@version 1.00 | Jan 7, 2010
 *	@author Justin Windle
 *  
 **/
 
package uk.co.lmfm.guppy.view 
{
	import uk.co.lmfm.guppy.view.components.alert.AlertView;
	import uk.co.lmfm.guppy.view.components.workspace.WorkspaceView;
	import uk.co.lmfm.guppy.view.components.project.ProjectView;
	import uk.co.lmfm.guppy.view.components.menu.MenuView;
	import uk.co.lmfm.guppy.view.components.update.UpdateView;

	import flash.display.Sprite;

	import uk.co.lmfm.guppy.view.components.settings.SettingsView;

	import org.puremvc.as3.multicore.interfaces.IMediator;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;

	/**
	 * ApplicationMediator
	 */
	public class ApplicationMediator extends Mediator implements IMediator 
	{
		//	----------------------------------------------------------------
		//	PUBLIC STATIC CONSTANTS
		//	----------------------------------------------------------------

		public static const NAME : String = "ApplicationMediator";

		//	----------------------------------------------------------------
		//	CONSTRUCTOR
		//	----------------------------------------------------------------

		public function ApplicationMediator(viewComponent : Sprite)
		{
			super(NAME, viewComponent);
		}

		//	----------------------------------------------------------------
		//	PUBLIC METHODS
		//	----------------------------------------------------------------

		override public function onRegister() : void
		{
			super.onRegister();
			
			var project : ProjectView = new ProjectView();
			component.addChild(project);
			
			var workspace : WorkspaceView = new WorkspaceView();
			component.addChild(workspace);
			
			var settings : SettingsView = new SettingsView();
			component.addChild(settings);
			
			var update : UpdateView = new UpdateView();
			component.addChild(update);
			
			var menu : MenuView = new MenuView();
			component.addChild(menu);
			
			var alert : AlertView = new AlertView();
			component.addChild(alert);
			
			facade.registerMediator(new ProjectMediator(project));			facade.registerMediator(new WorkspaceMediator(workspace));			facade.registerMediator(new SettingsMediator(settings));
			facade.registerMediator(new UpdateMediator(update));			facade.registerMediator(new MenuMediator(menu));			facade.registerMediator(new AlertMediator(alert));
		}

		//	----------------------------------------------------------------
		//	PUBLIC ACCESSORS
		//	----------------------------------------------------------------

		public function get component() : Sprite
		{
			return viewComponent as Sprite;
		}
	}
}
